#ifndef LCD_H__
#define LCD_H__

#include "stm32f1xx_hal.h"

#define LCD_ROTAGE_0    0
#define LCD_ROTAGE_90   1
#define LCD_ROTAGE_180  2
#define LCD_ROTAGE_270  3

#define RED                     0xf800
#define GREEN                   0x07e0
#define BLUE                    0x001f
#define YELLOW                  0xffe0
#define WHITE                   0xffff
#define BLACK                   0x0000
#define PURPLE                  0xf81f

typedef void (*SetRegion)(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);
typedef void (*WriteMany)(uint8_t count, uint8_t *data);
typedef uint16_t (*GetWidth)(void);
typedef uint16_t (*GetHeight)(void);

void LCD_init(WriteMany writeMany, SetRegion setRegion, GetWidth getWidth, GetHeight getHeight);


uint16_t LCD_setBgColor(uint16_t color);
uint16_t LCD_setPenColor(uint16_t color);
uint16_t LCD_getBgColor(void);
uint16_t LCD_getPenColor(void);


void LCD_fillRect(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);
void LCD_clearRect(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end);
void LCD_drawPoint(uint16_t x, uint16_t y);
void LCD_drawLine(uint16_t x0, uint16_t y0,uint16_t x1, uint16_t y1);
void LCD_showChar(uint16_t x, uint16_t y, uint8_t num, uint8_t mode);
void LCD_showTestImage(void);


uint16_t LCD_getWidth(void);
uint16_t LCD_getHeight(void);

#endif

